home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1997 February / macformat-047.iso / Shareware Plus / Developers / The Gray Council 1.2.1 / source / Core / GrayCouncil.h < prev   
Encoding:
Text File  |  1996-11-07  |  54.8 KB  |  1,537 lines  |  [TEXT/CWIE]

  1. //
  2. // The Gray Council
  3. // Copyright ©1996 by Trygve Isaacson. All Rights Reserved.
  4. //
  5. // Before using any of the Gray Council source code, read and
  6. // follow the licensing info in the accompanying documentation
  7. // or contact:
  8. //   <trygve@bombaydigital.com>
  9. //   <http://www.bombaydigital.com>
  10. //
  11. // Also check the web site above to make sure you have the latest version!
  12. //
  13. // The Gray Council provides a set of standard C++ classes that implement
  14. // the standard Apple Grayscale Appearance. The core classes do not
  15. // require any other code such as a particular class framework.
  16. // There are separate files provided that plug The Gray Council core
  17. // into class frameworks.
  18. //
  19. // Classes defined below:
  20. //    AGAObject -- abstract base class for most others
  21. //    MExclusiveObject -- mixin class for mutual exclusivity (e.g. radio)
  22. //    AGATextStyle -- text style attributes container
  23. //    AGADrawingEnvironment -- stack-based save/restore class for drawing attributes
  24. //    AGAStaticText -- simple string object
  25. //    AGAPushButton -- push button with auto default outline capability
  26. //    AGACheckBox -- check box with mixed state capability
  27. //    AGAOffscreenImage -- class for storing and drawing an offscreen pixmap
  28. //    AGARadioButton -- radio button with mixed state capability
  29. //    MIconButtonObject -- mixin class for icon buttons
  30. //    AGAIconPushButton -- AGAPushButton subclass for icon push buttons
  31. //    AGAIconCheckBox -- AGACheckBox subclass for on/off icon buttons
  32. //    AGAIconRadioButton -- AGARadioButton subclass for mutually exclusive
  33. //        on/off icon buttons
  34. //    AGATrackingIndicator -- abstract superclass for scroll bar and slider
  35. //    AGAScrollBar -- scroll bar with 32-bit values, live tracking, and
  36. //        proportional indicator capabilities
  37. //    AGASlider -- slider with pointy or rectangular indicator, optional
  38. //        labels, live tracking, proportional indicator capabilities
  39. //    AGAPopupMenu -- popup menu with optional title
  40. //    AGACustomPopupMenuSizer -- stack-based class to make PopupMenuSelect use custom font/size
  41. //    AGALittleArrows -- little up/down arrows with notification
  42. //    AGADisclosureTriangle -- disclosure triangle with animation
  43. //    AGAProgressIndicator -- determinate or indeterminate progress gauge
  44. //        with moving determinate origin capability
  45. //    AGASeparator -- separator line with automatic directionality
  46. //    AGAGroupBox -- primary or secondary group box with optional title or
  47. //        room for external title or control
  48. //    AGATabPanel -- folder tabs for switching panels
  49. //    GDIterator -- stack-based class for multi-screen drawing
  50. //
  51.  
  52. #pragma once
  53.  
  54. #ifndef __GRAYCOUNCIL__
  55. #define __GRAYCOUNCIL__
  56.  
  57. #define kGrayCouncilCopyright "\pThe Gray Council ©1996 by Trygve Isaacson. All Rights Reserved."
  58.  
  59. #include <Errors.h>
  60. #include <Events.h>
  61. #include <Fonts.h>
  62. #include <Gestalt.h>
  63. #include <Icons.h>
  64. #include <Menus.h>
  65. #include <OSUtils.h>
  66. #include <Quickdraw.h>
  67. #include <Resources.h>
  68. #include <TextEdit.h>
  69. #include <TextUtils.h>
  70. #include <Types.h>
  71. #include <Windows.h>
  72.  
  73. //
  74. // You must call InitGrayCouncil after initializing the Toolbox
  75. // and before instantiating any GrayCouncil objects. This routine
  76. // is called automatically if you call the framework-specific
  77. // initializer. If it returns an error, you should quit. The only
  78. // current error situation of this is an out-of-memory condition
  79. // during initialization of the offscreen images.
  80. //
  81.  
  82. extern OSErr InitGrayCouncil();
  83.  
  84. #pragma mark AGAObject
  85.  
  86. //
  87. // AGAObject ---------------------------------------------------------------
  88. //
  89. // All of the visual GrayCouncil objects inherit from AGAObject.
  90. //
  91. // In general, all you have to do with any AGAObject is instantiate it,
  92. // and then call its DrawObject() and TrackMouse() functions when needed.
  93. // When calling the drawing and mouse tracking functions (and this includes
  94. // functions where you set an attribute with redraw set to true), you must
  95. // ensure that the GrafPort and coordinate system are correct prior to the
  96. // call.
  97. //
  98. // Public functions:
  99. // - AGAObject. You supply its coordinate boundary.
  100. // - GetObjectBounds. Returns its coordinate boundary.
  101. // - SetObjectBounds. Call this to change its coordinate boundary.
  102. // - DrawObject. Draws the object. Assumes current port, pen normal.
  103. // - ContainsMouse. Returns true if specified mouse would hit it.
  104. // - TrackMouse. Handles a mouse click. Returns true if hit did something.
  105. // - SetEnable. Enables or disables it.
  106. // - SetBackgroundColors. Sets the colors the object will use when erasing its background.
  107. //
  108. // You can #define AGA_SUPERCLASS to be TObject or whatever
  109. // if you prefer to have the AGA stuff not be its own root
  110. // class hierarchy.
  111. //
  112.  
  113. class AGAObject
  114.  
  115. #ifdef AGA_SUPERCLASS
  116.     : public AGA_SUPERCLASS
  117. #endif // AGA_SUPERCLASS
  118.  
  119.     {
  120.     public:
  121.  
  122.         AGAObject(Rect* bounds);
  123.         virtual ~AGAObject();
  124.         
  125.         virtual void    GetObjectBounds(Rect* bounds);
  126.         virtual void    SetObjectBounds(Rect* bounds, Boolean redraw);
  127.         virtual void    DrawObject();
  128.         virtual Boolean    ContainsMouse(Point mouseLocation);
  129.         virtual Boolean    TrackMouse(Point mouseLocation);
  130.         virtual void    SetEnable(Boolean isEnabled, Boolean redraw);
  131.         virtual void    SetBackgroundColors(RGBColor* enabledColor, RGBColor* disabledColor);
  132.         virtual SInt32    GetValue();
  133.         virtual void    SetValue(SInt32 newValue, Boolean redraw);
  134.  
  135.         enum { kRedraw = true, kDontRedraw = false };
  136.         enum { kEnabled = true, kDisabled = false };
  137.         enum { kPressed = true, kNotPressed = false };
  138.         enum { kFrameInside = true, kFrameOutside = false };
  139.         enum { kIsDefault = true, kIsNotDefault = false };
  140.         enum { kAutomaticState = true, kNoAutomaticState = false };
  141.         enum { kLiveTracking = true, kNoLiveTracking = false };
  142.         enum { kProportional = true, kNotProportional = false };
  143.         enum { kHorizontal = true, kVertical = false };
  144.         enum { kTrackingIn = true, kTrackingOut = false };
  145.  
  146.     protected:
  147.  
  148.         // HitTest and SetTrackingState are called repeatedly by the default
  149.         // mouse tracker.
  150.         virtual Boolean    HitTest(Point mouseLocation);
  151.         virtual void    SetTrackingState(Boolean isIn);
  152.         virtual void    ApplyBackgroundColor();
  153.         
  154.         Rect        mBounds;
  155.         Boolean        mEnabled;
  156.         RGBColor    mEnabledBackgroundColor;
  157.         RGBColor    mDisabledBackgroundColor;
  158.     };
  159.  
  160. #pragma mark MExclusiveObject
  161.  
  162. //
  163. // MExclusiveObject ---------------------------------------------------------------
  164. //
  165. // MExclusiveObject is a mixin class for automatically keeping several
  166. // objects in a group mutually exclusive. The radio button class below
  167. // uses this to allow automatic radio button group behavior. MExclusiveObject
  168. // maintains knowledge of "groups" of objects. When one member of the group is
  169. // "hit", the other members of the group are sent the TurnOff() message. To
  170. // identify each object uniquely, the object has a pair of 32-bit identifiers.
  171. // Typically these can set to the group's ID and GrafPtr. This allows having
  172. // multiple windows that use the same group IDs. If you set the IDs to kNoGroupID,
  173. // then this automatic maintenance is bypassed.
  174. // The MacApp and PowerPlant adapter classes do not use this facility, because
  175. // these frameworks provide their own radio button group management.
  176. //
  177.  
  178. class MExclusiveObject
  179.     {
  180.     public:
  181.  
  182.         MExclusiveObject(UInt32 groupIDPart1, UInt32 groupIDPart2);
  183.         virtual ~MExclusiveObject();
  184.         
  185.         virtual void    SetGroupID(UInt32 groupIDPart1, UInt32 groupIDPart2);
  186.  
  187.         virtual void    TurnOff();
  188.  
  189.         UInt32    mGroupIDPart1;
  190.         UInt32    mGroupIDPart2;
  191.     };
  192.  
  193. const UInt32 kNoGroupID = 0xFFFFFFFF;
  194.  
  195. #pragma mark AGATextStyle
  196.  
  197. //
  198. // AGATextStyle ---------------------------------------------------------------
  199. //
  200. // Many of the controls can have their text style specified. AGATextStyle
  201. // is used for this. It defines the font, size, and style to be used for
  202. // drawing text.
  203. //
  204.  
  205. class AGATextStyle
  206.     {
  207.     public:
  208.  
  209.         AGATextStyle();
  210.         AGATextStyle(SInt16 fontNum, SInt16 fontSize, Style fontStyle);
  211.         AGATextStyle(StringPtr fontName, SInt16 fontSize, Style fontStyle);
  212.         AGATextStyle(const TextStyle& textStyle);
  213.  
  214. #ifdef __PowerPlant__
  215.         AGATextStyle(ResIDT inTextTraitsID);    // Note: implementation is in GrayCouncilPP.cpp
  216. #endif // __PowerPlant__
  217.         
  218.         void    PrepareForDrawing() const;
  219.  
  220.         SInt16    mFontNum;
  221.         SInt16    mFontSize;
  222.         Style    mFontStyle;
  223.     };
  224.  
  225. // These globals should be used in most cases. You can also roll your own.
  226. extern AGATextStyle gAGAStdSystemStyle;        // Typically Chicago 12. Standard.
  227. extern AGATextStyle gAGAStdSmallStyle;        // Typically Geneva 10. Slider labels.
  228. extern AGATextStyle gAGAStdBoldSmallStyle;    // Typically Geneva 10 bold. Small tab panels.
  229. extern AGATextStyle gAGAExtraSmallStyle;    // Typically Geneva 9. Use where you need a small control.
  230.  
  231. #pragma mark AGADrawingEnvironment
  232.  
  233. //
  234. // AGADrawingEnvironment ---------------------------------------------------------------
  235. //
  236. // AGADrawingEnvironment is a stack-based object that saves the existing drawing
  237. // settings upon construction, and restores them upon destruction. It also
  238. // cleanses the pen after saving the existing settings, so that our drawing
  239. // code can assume basic settings are in place.
  240. //
  241.  
  242. class AGADrawingEnvironment
  243.     {
  244.     public:
  245.     
  246.         AGADrawingEnvironment();
  247.         virtual ~AGADrawingEnvironment();
  248.         
  249.         void    SaveEnvironment();        // called by constructor
  250.         void    RestoreEnvironment();    // called by destructor
  251.     
  252.         void    Cleanse();                // called by constructor after saving environment
  253.                                         // sets drawing state to a clean set of values
  254.     
  255.     protected:
  256.     
  257.         PenState    mSavedPenState;
  258.         RGBColor    mSavedForeColor;
  259.         RGBColor    mSavedBackColor;
  260.         SInt16        mSavedFontNum;
  261.         SInt16        mSavedFontSize;
  262.         Style        mSavedFontStyle;
  263.     };
  264.  
  265. #pragma mark AGAStaticText
  266.  
  267. //
  268. // AGAStaticText ---------------------------------------------------------------
  269. //
  270. // AGAStaticText draws a static text string on a gray background.
  271. //
  272.  
  273. class AGAStaticText : public AGAObject
  274.     {
  275.     public:
  276.  
  277.         AGAStaticText(Rect* bounds, const AGATextStyle& textStyle, SInt32 justification);
  278.         AGAStaticText(Rect* bounds, const AGATextStyle& textStyle, SInt32 justification, StringPtr title);
  279.         AGAStaticText(Rect* bounds, const AGATextStyle& textStyle, SInt32 justification, SInt16 stringListResourceID, SInt16 stringIndex);
  280.         virtual ~AGAStaticText();
  281.         
  282.         virtual void    DrawObject();
  283.  
  284.         virtual void    SetTitle(StringPtr buttonTitle, Boolean redraw);
  285.  
  286.     protected:
  287.  
  288.         SInt32            mJustification;
  289.         Str255            mTitle;
  290.         AGATextStyle    mTextStyle;
  291.     };
  292.  
  293. #pragma mark AGAPushButton
  294.  
  295. //
  296. // AGAPushButton ---------------------------------------------------------------
  297. //
  298. // AGAPushButton implements the standard AGA pushbutton. It automatically
  299. // draws the default button outline if you set its mIsDefault property
  300. // by calling SetDefault; you specify whether the outline is inside or
  301. // outside the object's mBounds.
  302. //
  303.  
  304. class AGAPushButton : public AGAObject
  305.     {
  306.     public:
  307.  
  308.         AGAPushButton(Rect* bounds, const AGATextStyle& textStyle);
  309.         AGAPushButton(Rect* bounds, const AGATextStyle& textStyle, StringPtr buttonTitle);
  310.         AGAPushButton(Rect* bounds, const AGATextStyle& textStyle, SInt16 stringListResourceID, SInt16 stringIndex);
  311.         virtual ~AGAPushButton();
  312.         
  313.         virtual void    DrawObject();
  314.  
  315.         virtual void    SetTitle(StringPtr buttonTitle, Boolean redraw);
  316.         
  317.         virtual void    SetDefault(Boolean isDefault, Boolean frameInside);
  318.         virtual Boolean    IsDefault();
  319.  
  320.         virtual void    DrawButton(Boolean pressed);
  321.         
  322.     protected:
  323.  
  324.         virtual Boolean    HitTest(Point mouseLocation);
  325.         virtual void    SetTrackingState(Boolean isIn);
  326.  
  327.         virtual void    DrawButtonNormal(Boolean deep);
  328.         virtual void    DrawButtonPressed(Boolean deep);
  329.         virtual void    DrawButtonDisabled(Boolean deep);
  330.         
  331.         virtual void    DrawOutlineNormal(Boolean deep);
  332.         virtual void    DrawOutlineDisabled(Boolean deep);
  333.  
  334.         Boolean            mIsDefault;        // if true this button gets a default frame
  335.         Boolean            mFrameInside;    // if true the frame is inside mBounds; else outside
  336.         Str255            mTitle;
  337.         AGATextStyle    mTextStyle;
  338.     };
  339.  
  340. #pragma mark AGACheckBox
  341.  
  342. //
  343. // AGACheckBox ---------------------------------------------------------------
  344. //
  345. // AGACheckBox implements the standard AGA check box. It also supports
  346. // a mixed state that is neither on nor off, which is drawn as a dash.
  347. //
  348.  
  349. class AGACheckBox : public AGAObject
  350.     {
  351.     public:
  352.  
  353.         enum { kCheckBoxSize = 12 };
  354.         enum { kCheckBoxOff = 0, kCheckBoxOn = 1, kCheckBoxMixed = 2 };
  355.  
  356.         AGACheckBox(Rect* bounds, const AGATextStyle& textStyle, Boolean automaticState);
  357.         AGACheckBox(Rect* bounds, const AGATextStyle& textStyle, StringPtr buttonTitle, Boolean automaticState);
  358.         AGACheckBox(Rect* bounds, const AGATextStyle& textStyle, SInt16 stringListResourceID, SInt16 stringIndex, Boolean automaticState);
  359.         virtual ~AGACheckBox();
  360.         
  361.         virtual void    DrawObject();
  362.         virtual Boolean    TrackMouse(Point mouseLocation);
  363.  
  364.         virtual void    SetTitle(StringPtr buttonTitle, Boolean redraw);
  365.         
  366.         virtual SInt32    GetValue();
  367.         virtual void    SetValue(SInt32 newValue, Boolean redraw);
  368.  
  369.         virtual void    DrawButton(Boolean pressed);
  370.  
  371.     protected:
  372.  
  373.         virtual void    SetTrackingState(Boolean isIn);
  374.  
  375.         virtual void    DrawButtonNormal(Boolean deep);
  376.         virtual void    DrawButtonPressed(Boolean deep);
  377.         virtual void    DrawButtonDisabled(Boolean deep);
  378.         
  379.         SInt32            mValue;
  380.         Boolean            mAutomaticState;    // if true, check is toggled on click w/o caller needing to call SetValue
  381.         Str255            mTitle;
  382.         AGATextStyle    mTextStyle;
  383.     };
  384.  
  385. #pragma mark AGAOffscreenImage
  386.  
  387. //
  388. // AGAOffscreenImage ------------------------------------------------------------
  389. //
  390. // AGAOffscreenImage holds the data needed to blast a clipped region
  391. // of pixel values onto the current port. This is used by the AGARadioButton
  392. // class to avoid the ultra-tedious pixel-by-pixel drawing of the grayscale
  393. // radio button images, and by the tab panel for the tab corners.
  394. //
  395.  
  396. class AGAOffscreenImage
  397.  
  398. #ifdef AGA_SUPERCLASS
  399.     : public AGA_SUPERCLASS
  400. #endif // AGA_SUPERCLASS
  401.     {
  402.     public:
  403.     
  404.         AGAOffscreenImage();
  405.         virtual ~AGAOffscreenImage();
  406.         
  407.         virtual OSErr    CreateImageData(Point imageSize,
  408.                                 SInt8* imageColorIndexes,
  409.                                 RgnHandle clippingRegion,
  410.                                 const RGBColor* outsideColor);
  411.         
  412.         void    DrawImage(SInt16 imageHOrigin, SInt16 imageVOrigin);    // splats 1 copy of the image
  413.         void    DrawPattern(Rect* imageRect);                            // splats multiple copies of the image
  414.  
  415.     protected:
  416.  
  417.         Rect            mImageSourceRect;    // 0, 0, x, y
  418.         PixMapHandle    mImagePixMap;
  419.         RgnHandle        mClippingRegion;
  420.     };
  421.  
  422. #pragma mark AGARadioButton
  423.  
  424. //
  425. // AGARadioButton ---------------------------------------------------------------
  426. //
  427. // AGARadioButton implements the standard AGA radio button. It also supports
  428. // a mixed state that is neither on nor off, which is drawn as a dash.
  429. // You can also assign an ID pair that will be used to automatically keep
  430. // the radio button mutually exclusive with others with the same ID pair.
  431. // Pass kNoGroupID for the IDs to bypass this. The adapter classes bypass it
  432. // since the frameworks manage radio button groups.
  433. //
  434.  
  435. class AGARadioButton : public AGAObject, public MExclusiveObject
  436.     {
  437.     public:
  438.  
  439.         enum { kRadioButtonOff = 0, kRadioButtonOn = 1, kRadioButtonMixed = 2 };
  440.  
  441.         static OSErr AllocateRadioImages();
  442.         static void DisposeRadioImages();
  443.  
  444.         AGARadioButton(Rect* bounds, const AGATextStyle& textStyle, UInt32 groupIDPart1, UInt32 groupIDPart2, Boolean automaticState);
  445.         AGARadioButton(Rect* bounds, const AGATextStyle& textStyle, StringPtr buttonTitle, UInt32 groupIDPart1, UInt32 groupIDPart2, Boolean automaticState);
  446.         AGARadioButton(Rect* bounds, const AGATextStyle& textStyle, SInt16 stringListResourceID, SInt16 stringIndex, UInt32 groupIDPart1, UInt32 groupIDPart2, Boolean automaticState);
  447.         virtual ~AGARadioButton();
  448.         
  449.         virtual void    DrawObject();
  450.         virtual Boolean    TrackMouse(Point mouseLocation);
  451.  
  452.         virtual void    SetTitle(StringPtr buttonTitle, Boolean redraw);
  453.         
  454.         virtual SInt32    GetValue();
  455.         virtual void    SetValue(SInt32 newValue, Boolean redraw);
  456.  
  457.         virtual void    SetGroupID(UInt32 groupIDPart1, UInt32 groupIDPart2);    // MExclusiveObject mixin override
  458.         virtual void    TurnOff();    // MExclusiveObject mixin override
  459.  
  460.         virtual void    DrawButton(Boolean pressed);
  461.  
  462.     protected:
  463.  
  464.         virtual void    SetTrackingState(Boolean isIn);
  465.  
  466.         virtual void    DrawButtonNormal(Boolean deep);
  467.         virtual void    DrawButtonPressed(Boolean deep);
  468.         virtual void    DrawButtonDisabled(Boolean deep);
  469.         
  470.         virtual void    CopyImage(UInt32 index);
  471.         
  472.         SInt32            mValue;
  473.         Boolean            mAutomaticState;    // if true, radio is set on click w/o caller needing to call SetValue
  474.         UInt32            mGroupID;
  475.         Str255            mTitle;
  476.         AGATextStyle    mTextStyle;
  477.         
  478.         // Drawing the 3D radio button manually is just too damn tedious.
  479.         // So we use offscreen PixMap structures and blast them onto the screen.
  480.         // The mask (clip) region for the images is a round rectangle.
  481.  
  482.         enum { kRadioImageWidth = 12, kRadioImageHeight = 12 };
  483.         enum { kRadioNormalOff, kRadioNormalOn, kRadioNormalMixed,
  484.                 kRadioPressedOff, kRadioPressedOn, kRadioPressedMixed,
  485.                 kRadioDisabledOff, kRadioDisabledOn, kRadioDisabledMixed,
  486.                 kNumRadioImages };
  487.         
  488.         static SInt8                kRadioImageValues[kNumRadioImages]
  489.                                                     [kRadioImageHeight]
  490.                                                     [kRadioImageWidth];
  491.  
  492.         static AGAOffscreenImage*    mgOffscreenRadioImages[kNumRadioImages];
  493.     };
  494.  
  495. #pragma mark MIconButtonObject
  496.  
  497. //
  498. // MIconButtonObject ---------------------------------------------------------------
  499. //
  500. // MIconButtonObject is a mixin class for the classes that have an
  501. // icon button appearance. There are two different basic visual
  502. // attributes for a button: the frame type and the image type.
  503. //
  504. // The frame type determines what the button edges look like. There
  505. // are 3 different frame types specified by the AGA. The size of
  506. // the button determines which frame type is used, but you can
  507. // force a given type to be used.
  508. // - 40x40 or larger: kLargeFrame (4 pixels shading on each side)
  509. //        This is room for a 32x32 'iclx' plus the shading.
  510. // - 22x22 or larger: kSmallFrame (3 pixels shading on each side)
  511. //        This is room for a 16x16 'icsx' plus the shading.
  512. // - 16x16 or larger: kMiniFrame (2 pixels shading on each side)
  513. //        This is room for a 12x12 'icmx' plus the shading.
  514. // The constant kAutoFrame is used by default. This sets the frame type
  515. // automatically based on the actual button bounds. The dimensions shown
  516. // above are the ideal dimensions shown in the AGA spec.
  517. //
  518. // The image type determines how the actual picture image inside the
  519. // button is drawn. By default the image type is an icon family of size
  520. // based on the button size (according to the frame sizes listed above),
  521. // but you can explicitly set the type, including non-icon-family types.
  522. // In all cases, the image is centered inside the button frame.
  523. // - kAutoIconFamily: 32x32, 16x16, or 12x12 icon rect, derived from
  524. //        the button bounds, according to the ideal sizes list above,
  525. //        using an icon family.
  526. // - kLargeIcon: 32x32 icon rect ('iclx' size) using an icon family.
  527. // - kSmallIcon: 16x16 icon rect ('icsx' size) using an icon family.
  528. // - kMiniIcon: 12x12 icon rect ('icmx' size) using an icon family.
  529. // - kColorIcon: arbitrary icon rect derived from / using a 'cicn' resource.
  530. // - kPictureIcon: arbitrary icon rect derived from / using a 'PICT' resource.
  531. //
  532. // An icon button has two image resource IDs. Usually these are the same,
  533. // but for some button types you can make them different. For example, if
  534. // you want different icons for on/off when the button is used as a radio
  535. // button or check box, you can set the IDs to different values.
  536. //
  537. // Note that mini icons are a rather rare resource type, and ResEdit 2.x
  538. // doesn't have an editor for them. I think Resorcerer does.
  539. //
  540.  
  541. class MIconButtonObject
  542.     {
  543.     public:
  544.     
  545.         enum { kNoIconID = -1 };
  546.         enum ButtonFrameType { kAutoFrame, kLargeFrame, kSmallFrame, kMiniFrame };
  547.         enum ButtonImageType { kAutoIconFamily, kLargeIcon, kSmallIcon, kMiniIcon, kColorIcon, kPictureIcon };
  548.  
  549.         MIconButtonObject();
  550.         MIconButtonObject(SInt16 offIconID, SInt16 onIconID, ButtonFrameType frameType, ButtonImageType imageType);
  551.         virtual ~MIconButtonObject();
  552.         
  553.         virtual void    SetIconIDs(SInt16 offIconID, SInt16 onIconID);
  554.         virtual void    SetFrameType(ButtonFrameType frameType);
  555.         virtual void    SetImageType(ButtonImageType imageType);
  556.         
  557.         virtual void    DrawIconButton(Rect* bounds,
  558.                                         Boolean isOn,
  559.                                         Boolean isPressed,
  560.                                         Boolean isEnabled,
  561.                                         Boolean deep);
  562.  
  563.         static ButtonFrameType    GetDefaultFrameType(SInt16 buttonWidth);
  564.         static ButtonImageType    GetDefaultImageType(SInt16 buttonWidth);
  565.  
  566.     protected:
  567.  
  568.         virtual void    DrawMiniEdges(Rect* bounds, Boolean isOn, Boolean isPressed, Boolean isEnabled);
  569.         virtual void    DrawSmallEdges(Rect* bounds, Boolean isOn, Boolean isPressed, Boolean isEnabled);
  570.         virtual void    DrawLargeEdges(Rect* bounds, Boolean isOn, Boolean isPressed, Boolean isEnabled);
  571.  
  572.         virtual PicHandle    GetPictureImage(Point* imageSize, SInt16 pictureResourceID);
  573.         virtual CIconHandle    GetColorIconImage(Point* imageSize, SInt16 cicnResourceID);
  574.  
  575.         SInt16            mOffIconID;
  576.         SInt16            mOnIconID;
  577.         ButtonFrameType    mFrameType;
  578.         ButtonImageType    mImageType;
  579.     };
  580.  
  581. #pragma mark AGAIconPushButton
  582.  
  583. //
  584. // AGAIconPushButton ---------------------------------------------------------------
  585. //
  586. // AGAIconPushButton implements the standard AGA icon button, with
  587. // pushbutton behavior; that is to say, it has no state. This is
  588. // done by subclassing AGAPushButton for tracking, and mixing in
  589. // MIconButtonObject for drawing.
  590. //
  591.  
  592. class AGAIconPushButton : public AGAPushButton, public MIconButtonObject
  593.     {
  594.     public:
  595.  
  596.         AGAIconPushButton(Rect* bounds);
  597.         AGAIconPushButton(Rect* bounds, SInt16 iconID, ButtonFrameType frameType, ButtonImageType imageType);
  598.         virtual ~AGAIconPushButton();
  599.         
  600.     protected:
  601.  
  602.         virtual void    DrawButtonNormal(Boolean deep);
  603.         virtual void    DrawButtonPressed(Boolean deep);
  604.         virtual void    DrawButtonDisabled(Boolean deep);
  605.     };
  606.  
  607. #pragma mark AGAIconCheckBox
  608.  
  609. //
  610. // AGAIconCheckBox ---------------------------------------------------------------
  611. //
  612. // AGAIconCheckBox implements the standard AGA icon button, with
  613. // check box behavior; that is to say, it has an on or off state
  614. // that toggles when hit. This is done by subclassing AGACheckBox
  615. // for tracking and state, and mixing in MIconButtonObject for drawing.
  616. //
  617.  
  618. class AGAIconCheckBox : public AGACheckBox, public MIconButtonObject
  619.     {
  620.     public:
  621.  
  622.         AGAIconCheckBox(Rect* bounds, Boolean automaticState);
  623.         AGAIconCheckBox(Rect* bounds, Boolean automaticState, SInt16 offIconID, SInt16 onIconID, ButtonFrameType frameType, ButtonImageType imageType);
  624.         virtual ~AGAIconCheckBox();
  625.         
  626.     protected:
  627.  
  628.         virtual void    DrawButtonNormal(Boolean deep);
  629.         virtual void    DrawButtonPressed(Boolean deep);
  630.         virtual void    DrawButtonDisabled(Boolean deep);
  631.     };
  632.  
  633. #pragma mark AGAIconRadioButton
  634.  
  635. //
  636. // AGAIconRadioButton ---------------------------------------------------------------
  637. //
  638. // AGAIconRadioButton implements the standard AGA icon button, with
  639. // radio button behavior; that is to say, it has an on or off state
  640. // that can be automatically made mutually exclusive with other
  641. // buttons in its group. This is done by subclassing AGARadioButton
  642. // for tracking and state, and mixing in MIconButtonObject for drawing.
  643. //
  644.  
  645. class AGAIconRadioButton : public AGARadioButton, public MIconButtonObject
  646.     {
  647.     public:
  648.  
  649.         AGAIconRadioButton(Rect* bounds, UInt32 groupIDPart1, UInt32 groupIDPart2, Boolean automaticState);
  650.         AGAIconRadioButton(Rect* bounds, UInt32 groupIDPart1, UInt32 groupIDPart2, Boolean automaticState, SInt16 offIconID, SInt16 onIconID, ButtonFrameType frameType, ButtonImageType imageType);
  651.         virtual ~AGAIconRadioButton();
  652.         
  653.     protected:
  654.  
  655.         virtual void    DrawButtonNormal(Boolean deep);
  656.         virtual void    DrawButtonPressed(Boolean deep);
  657.         virtual void    DrawButtonDisabled(Boolean deep);
  658.     };
  659.  
  660. #pragma mark AGATrackingIndicator
  661.  
  662. //
  663. // AGATrackingIndicator ---------------------------------------------------------------
  664. //
  665. // AGATrackingIndicator is the abstract superclass for things like
  666. // sliders and scroll bars that have a moving indicator to reflect
  667. // the object's position. It has a minimum/maximum range, a current
  668. // value, and optionally a page size for proportional indicator
  669. // display. You can turn live tracking on or off; if live tracking
  670. // is off, a "ghost" indicator is dragged and no notification occurs
  671. // until the tracking completes.
  672. //
  673.  
  674. class AGATrackingIndicator;
  675.  
  676. // This is the live tracking notification prototype for AGATrackingIndicator.
  677. typedef void (*AGATrackingIndicatorNotifyPtr)(AGATrackingIndicator* theIndicator, SInt32 itsNewValue, void* userData);
  678.  
  679. class AGATrackingIndicator : public AGAObject
  680.     {
  681.     public:
  682.  
  683.         AGATrackingIndicator(Rect* bounds, SInt32 minimum, SInt32 maximum, SInt32 initialValue);
  684.         AGATrackingIndicator(Rect* bounds, SInt32 minimum, SInt32 maximum, SInt32 initialValue, SInt32 pageSize, Boolean liveTracking, Boolean proportional);
  685.         virtual ~AGATrackingIndicator();
  686.         
  687.         virtual void    InstallNotificationRoutine(AGATrackingIndicatorNotifyPtr notificationRoutine, void* userData);
  688.         
  689.         virtual void    SetAttributes(Boolean isHorizontal, Boolean liveTracking, Boolean isProportional);
  690.         virtual void    SetLiveTracking(Boolean liveTracking);
  691.  
  692.         virtual void    DrawObject();
  693.         virtual Boolean    TrackMouse(Point mouseLocation);
  694.         
  695.         virtual SInt32    GetValue();
  696.         virtual void    SetValue(SInt32 newValue, Boolean redraw);
  697.  
  698.         virtual void    GetRange(SInt32* minimum, SInt32* maximum);
  699.         virtual void    SetRange(SInt32 newMinimum, SInt32 newMaximum, Boolean redraw);
  700.         
  701.         virtual SInt32    GetPageSize();
  702.         virtual void    SetPageSize(SInt32 newPageSize, Boolean redraw);
  703.  
  704.     protected:
  705.  
  706.         enum { kNoTrackPress, kPageMinusPress, kArrowMinusPress, kIndicatorPress, kArrowPlusPress, kPagePlusPress };
  707.  
  708.         virtual Boolean    TrackPart(Point mouseLocation, SInt32 partHit);
  709.         virtual SInt32    TrackTestPart(Point mouseLocation);
  710.         virtual Boolean    IsValidIndicatorTrackMouse(Point mouseLocation);
  711.         virtual SInt32    GetValueFromMouseDelta(SInt32 originalValue, Point originalMouseLocation, Point newMouseLocation);
  712.         virtual void    SetGhostValue(SInt32 newValue, Boolean redraw);
  713.  
  714.         virtual void    DrawBackground();
  715.         virtual void    DrawIndicatorTrack();
  716.         virtual void    DrawTrackEnds();
  717.         virtual void    DrawIndicator();
  718.         virtual void    RemoveIndicator(SInt32 newValue);
  719.         virtual void    DrawGhost();
  720.         virtual void    RemoveGhost(SInt32 newValue);
  721.         
  722.         virtual void    NotifyValue();
  723.         
  724.         SInt32    mMinimum;
  725.         SInt32    mMaximum;
  726.         SInt32    mValue;
  727.         SInt32    mPageSize;
  728.         SInt32    mGhostValue;
  729.         Boolean    mLiveTracking;
  730.         Boolean    mIsProportional;
  731.         Boolean    mIsHorizontal;
  732.         Boolean    mIsPressed;
  733.         
  734.         AGATrackingIndicatorNotifyPtr    mNotificationRoutine;
  735.         void*                            mUserData;
  736.     };
  737.  
  738. #pragma mark AGAScrollBar
  739.  
  740. //
  741. // AGAScrollBar ---------------------------------------------------------------
  742. //
  743. // AGAScrollBar implements the standard AGA scroll bar. It also supports
  744. // live indicator tracking and a proportional indicator as options.
  745. //
  746.  
  747. class AGAScrollBar : public AGATrackingIndicator
  748.     {
  749.     public:
  750.  
  751.         AGAScrollBar(Rect* bounds, SInt32 minimum, SInt32 maximum, SInt32 initialValue);
  752.         AGAScrollBar(Rect* bounds, SInt32 minimum, SInt32 maximum, SInt32 initialValue, SInt32 singleStepSize, SInt32 pageStepSize, SInt32 pageSize, Boolean liveTracking, Boolean proportional);
  753.         virtual ~AGAScrollBar();
  754.  
  755.         virtual void    SetRange(SInt32 newMinimum, SInt32 newMaximum, Boolean redraw);
  756.  
  757.         virtual void    SetStepSizes(SInt32 singleStepSize, SInt32 pageStepSize);
  758.         virtual void    Activate(Boolean activateState, Boolean redraw);
  759.  
  760.     protected:
  761.  
  762.         virtual Boolean    TrackPart(Point mouseLocation, SInt32 partHit);
  763.         virtual SInt32    TrackTestPart(Point mouseLocation);
  764.         virtual Boolean    IsValidIndicatorTrackMouse(Point mouseLocation);
  765.         virtual SInt32    GetValueFromMouseDelta(SInt32 originalValue, Point originalMouseLocation, Point newMouseLocation);
  766.  
  767.         virtual void    DrawIndicatorTrack();
  768.         virtual void    DrawTrackEnds();
  769.         virtual void    DrawIndicator();
  770.         virtual void    RemoveIndicator(SInt32 newValue);
  771.         virtual void    DrawGhost();
  772.         virtual void    RemoveGhost(SInt32 newValue);
  773.         
  774.         virtual void    TrackDelta(SInt32 partHit);
  775.  
  776.         virtual void    DrawArrow(SInt32 arrowPart, Boolean pressed);
  777.         
  778.         enum { kIndicatorPixelInset = 8 };
  779.         enum { kArrowSize = 16 };
  780.  
  781.         virtual void    GetIndicatorBox(SInt32 value, Rect* indicatorBox);
  782.         virtual SInt32    GetIndicatorPixelRange(SInt32* proportionalIndicatorPixels);
  783.         virtual void    GetIndicatorPixelEnds(SInt32* startPt, SInt32* stopPt);
  784.         virtual void    GetIndicatorSpan(SInt32 value, SInt32* startPt, SInt32* valuePt, SInt32* stopPt);
  785.         
  786.         SInt32    mSingleStepSize;    // amount to delta for arrow tracking
  787.         SInt32    mPageStepSize;        // amount to delta for page tracking
  788.         Boolean    mActive;            // inactive windows have inactive scroll bars
  789.         
  790.         // These regions are used by RemoveIndicator and RemoveGhost.
  791.         // They are tiny but we allocate them statically to avoid
  792.         // repeated allocation, which could conceivably fail.
  793.         static RgnHandle    mgSavedIndicatorClip;
  794.         static RgnHandle    mgOldIndicatorClip;
  795.         static RgnHandle    mgNewIndicatorClip;
  796.     };
  797.  
  798. #pragma mark AGASlider
  799.  
  800. //
  801. // AGASlider ---------------------------------------------------------------
  802. //
  803. // AGASlider implements the standard AGA slider. You specify whether it
  804. // is horizontal or vertical, labeled or unlabeled, rectangular or pointy.
  805. // By default, if you specify a labeled slider, it is pointy; otherwise it
  806. // is rectangular. You can change this by calling SetSliderKind, and you
  807. // can set the labels up after construction by calling the label functions.
  808. // It also supports live indicator tracking and a proportional indicator
  809. // as options.
  810. //
  811.  
  812. class AGASlider : public AGATrackingIndicator
  813.     {
  814.     public:
  815.  
  816.         enum SliderKind { kRectSlider, kPointerSlider };
  817.  
  818.         AGASlider(Rect* bounds, SInt32 minimum, SInt32 maximum, SInt32 initialValue, const AGATextStyle& textStyle, SInt16 labelsID);
  819.         AGASlider(Rect* bounds, SInt32 minimum, SInt32 maximum, SInt32 initialValue, const AGATextStyle& textStyle, SInt16 labelsID, SliderKind kind, Boolean liveTracking, Boolean proportional);
  820.         virtual ~AGASlider();
  821.         
  822.         virtual void    SetSliderKind(SliderKind kind);
  823.         virtual void    SetLabelsFromResource(SInt16 stringListResourceID);
  824.         virtual void    SetNumLabels(UInt32 numLabels);
  825.         virtual void    SetLabel(UInt32 labelIndex, StringPtr itsLabel);
  826.         virtual void    GetLabel(UInt32 labelIndex, StringPtr itsLabel);
  827.         virtual void    SetLabelsStyle(const AGATextStyle& textStyle);
  828.         virtual void    SetJustification(SInt32 justification);
  829.  
  830.     protected:
  831.  
  832.         virtual SInt32    TrackTestPart(Point mouseLocation);
  833.         virtual Boolean    IsValidIndicatorTrackMouse(Point mouseLocation);
  834.         virtual SInt32    GetValueFromMouseDelta(SInt32 originalValue, Point originalMouseLocation, Point newMouseLocation);
  835.  
  836.         virtual void    DrawBackground();
  837.         virtual void    DrawIndicatorTrack();
  838.         virtual void    DrawIndicator();
  839.         virtual void    RemoveIndicator(SInt32 newValue);
  840.         virtual void    DrawGhost();
  841.         virtual void    RemoveGhost(SInt32 newValue);
  842.         
  843.         enum { kRectIndicatorPixelInset = 6 };
  844.         enum { kPointerIndicatorPixelInset = 7 };
  845.         enum { kIndicatorWidth = 16 };
  846.         enum { kEndGapSize = 5 };
  847.         enum { kLabelTickEndInset = 11 };
  848.         enum { kLabelTickOffset = 8 };
  849.         enum { kLabelPosTextOffset = 14 };
  850.         enum { kLabelNegTextOffset = 8 };
  851.         enum { kLabelTickLength = 6 };
  852.         enum { kGhostIndicator = true, kNormalIndicator = false };
  853.         enum { kIncludeBackground = true, kTrackOnly = false };
  854.  
  855.         virtual void    GetTrackFrame(Rect* trackFrame, Boolean includeBackground);
  856.         virtual void    GetIndicatorBox(SInt32 value, Rect* indicatorBox);
  857.         virtual SInt32    GetIndicatorPixelRange(SInt32* proportionalIndicatorPixels);
  858.         virtual void    GetIndicatorPixelEnds(SInt32* startPt, SInt32* stopPt);
  859.         virtual void    GetIndicatorSpan(SInt32 value, SInt32* startPt, SInt32* valuePt, SInt32* stopPt);
  860.         
  861.         virtual void    DrawLabels();
  862.         virtual void    DrawRectIndicator(Rect* indicatorRect, Boolean isGhost);
  863.         virtual void    DrawPointerIndicator(Rect* indicatorRect, Boolean isGhost);
  864.         virtual void    BuildPointerIndicator(Rect* indicatorRect);
  865.         
  866.         virtual void    DisposeLabels();
  867.         
  868.         Handle            mLabelStringHandles;    // an array of StringHandle, may be NULL
  869.         SInt32            mJustification;
  870.         SliderKind        mSliderKind;
  871.         AGATextStyle    mTextStyle;
  872.         
  873.         // These regions are used by RemoveIndicator and RemoveGhost.
  874.         // They are tiny but we allocate them statically to avoid
  875.         // repeated allocation, which could conceivably fail.
  876.         static RgnHandle    mgSavedIndicatorClip;
  877.         static RgnHandle    mgOldIndicatorClip;
  878.         static RgnHandle    mgNewIndicatorClip;
  879.     };
  880.  
  881. #pragma mark AGAPopupMenu
  882.  
  883. //
  884. // AGAPopupMenu ---------------------------------------------------------------
  885. //
  886. // AGAPopupMenu implements the standard AGA pop-up menu. You can specify
  887. // whether the supplied boundary is fixed or whether the pop-up button
  888. // should adapt its width to the width of the associated menu. You can
  889. // also supply a title to be drawn next to the pop-up button.
  890. //
  891.  
  892. class AGAPopupMenu : public AGAObject
  893.     {
  894.     public:
  895.  
  896.         enum WidthAdjust { kFixedWidth = -1, kUseMenuWidth = 0, kSystemMDEFAdjustment = 19 };
  897.         enum DisposalKind { kDontDispose, kDispose, kRelease };
  898.  
  899.         AGAPopupMenu(Rect* bounds, SInt16 titleOffset, StringPtr title, SInt32 titleJustification, const AGATextStyle& titleStyle, const AGATextStyle& textStyle, WidthAdjust adjustment);
  900.         AGAPopupMenu(Rect* bounds, SInt16 titleOffset, StringPtr title, SInt32 titleJustification, const AGATextStyle& titleStyle, const AGATextStyle& textStyle, WidthAdjust adjustment, MenuRef itsMenuRef, DisposalKind menuRefDisposalKind);
  901.         AGAPopupMenu(Rect* bounds, SInt16 titleOffset, StringPtr title, SInt32 titleJustification, const AGATextStyle& titleStyle, const AGATextStyle& textStyle, WidthAdjust adjustment, SInt16 itemsStringListID, SInt16 newMenuID);
  902.         AGAPopupMenu(Rect* bounds, SInt16 titleOffset, StringPtr title, SInt32 titleJustification, const AGATextStyle& titleStyle, const AGATextStyle& textStyle, WidthAdjust adjustment, ResType appendResourceType, SInt16 newMenuID);
  903.         virtual ~AGAPopupMenu();
  904.         
  905.         virtual void    SetMenuRef(MenuRef itsMenuRef, DisposalKind menuRefDisposalKind);
  906.         virtual void    SetWidthAdjustment(WidthAdjust adjustment);
  907.         
  908.         virtual void    DrawObject();
  909.         virtual Boolean    TrackMouse(Point mouseLocation);
  910.  
  911.         virtual SInt16    GetCurrentItemNo();
  912.         virtual void    SetCurrentItemNo(SInt16 newItemNo, Boolean redraw);
  913.         
  914.         virtual void    GetCurrentItemText(StringPtr itemText);
  915.         virtual Boolean    SetCurrentItemText(StringPtr itemTextToMatch, Boolean redraw);    // returns false if no match found
  916.         virtual void    SetTitle(StringPtr newTitle, Boolean redraw);
  917.  
  918.         virtual void    DrawButton(Boolean pressed);
  919.  
  920.     protected:
  921.  
  922.         virtual void    DrawButtonNormal(Boolean deep);
  923.         virtual void    DrawButtonPressed(Boolean deep);
  924.         virtual void    DrawButtonDisabled(Boolean deep);
  925.         virtual void    GetButtonBounds(Rect* buttonBounds);
  926.         virtual void    GetTitleBounds(Rect* titleBounds);
  927.         
  928.         virtual void    DisposeExistingMenuRef();
  929.         
  930.         enum { kPopupArrowSectionWidth = 22 };
  931.  
  932.         SInt16            mMenuID;
  933.         MenuRef            mMenuRef;
  934.         DisposalKind    mMenuRefDisposalKind;
  935.         SInt16            mCurrentItemNo;
  936.         WidthAdjust        mWidthAdjust;
  937.         AGATextStyle    mTitleStyle;
  938.         AGATextStyle    mTextStyle;
  939.         Str255            mTitle;
  940.         SInt16            mTitleOffset;
  941.         SInt32            mTitleJustification;
  942.     };
  943.  
  944. #pragma mark AGACustomPopupMenuSizer
  945.  
  946. //
  947. // AGACustomPopupMenuSizer -------------------------------------------------------
  948. //
  949. // AGACustomPopupMenuSizer is a stack-based object that will prepare the
  950. // drawing environment for a custom popup menu font/size. This is a
  951. // low-level toolbox hack capability.
  952. // This is used to wrap calls to PopupMenuSelect and CalcMenuSize.
  953. //
  954.  
  955. class AGACustomPopupMenuSizer
  956.     {
  957.     public:
  958.     
  959.         AGACustomPopupMenuSizer(SInt16 fontNum, SInt16 fontSize);
  960.         virtual ~AGACustomPopupMenuSizer();
  961.         
  962.         void    SaveEnvironment();            // called by constructor
  963.         void    RestoreEnvironment();        // called by destructor
  964.         
  965.         void    InstallCustomEnvironment();    // called by constructor after saving
  966.  
  967.         Boolean    mIsCustom;
  968.  
  969.     protected:
  970.     
  971.         SInt16    mSavedFontNum;
  972.         SInt16    mSavedFontSize;
  973.         SInt16    mCustomFontNum;
  974.         SInt16    mCustomFontSize;
  975.     };
  976.  
  977. #pragma mark AGALittleArrows
  978.  
  979. //
  980. // AGALittleArrows ---------------------------------------------------------------
  981. //
  982. // AGALittleArrows implements the standard AGA little arrows. To respond
  983. // to continuous messages during tracking, you should either install a
  984. // notification routine or subclass and override NotifyDelta. The supplied
  985. // MacApp and PowerPlant classes do this for you.
  986. //
  987.  
  988. class AGALittleArrows;
  989.  
  990. // This is the live tracking notification prototype for AGALittleArrows.
  991. typedef void (*AGALittleArrowsNotifyPtr)(AGALittleArrows* theIndicator, SInt32 pressedPart, void* userData);
  992.  
  993. class AGALittleArrows : public AGAObject
  994.     {
  995.     public:
  996.  
  997.         enum { kDownArrowPressed = -1, kNoArrowPressed = 0, kUpArrowPressed = 1 };
  998.  
  999.         AGALittleArrows(Rect* bounds);
  1000.         virtual ~AGALittleArrows();
  1001.         
  1002.         virtual void    InstallNotificationRoutine(AGALittleArrowsNotifyPtr notificationRoutine, void* userData);
  1003.         
  1004.         virtual void    DrawObject();
  1005.         virtual Boolean    TrackMouse(Point mouseLocation);
  1006.  
  1007.         virtual void    DrawButton(SInt32 pressedPart);
  1008.         
  1009.     protected:
  1010.  
  1011.         enum { kLittleArrowWidth = 13, kLittleArrowHeight = 12, kLittleArrowTotalHeight = 23 };
  1012.  
  1013.         virtual Boolean    TrackPart(Point mouseLocation, SInt32 partHit);
  1014.         virtual SInt32    TrackTestPart(Point mouseLocation);
  1015.  
  1016.         virtual void    NotifyDelta(SInt32 partHit);
  1017.         
  1018.         AGALittleArrowsNotifyPtr    mNotificationRoutine;
  1019.         void*                        mUserData;
  1020.     };
  1021.  
  1022. #pragma mark AGADisclosureTriangle
  1023.  
  1024. //
  1025. // AGADisclosureTriangle ---------------------------------------------------------------
  1026. //
  1027. // AGADisclosureTriangle implements the standard AGA disclosure triangle.
  1028. // You can think of it as a check box that is either off (closed) or on
  1029. // (disclosed).
  1030. //
  1031.  
  1032. class AGADisclosureTriangle : public AGAObject
  1033.     {
  1034.     public:
  1035.  
  1036.         enum { kDisclosedState = true, kClosedState = false };
  1037.  
  1038.         AGADisclosureTriangle(Rect* bounds, Boolean automaticState);
  1039.         virtual ~AGADisclosureTriangle();
  1040.         
  1041.         virtual void    DrawObject();
  1042.         virtual Boolean    TrackMouse(Point mouseLocation);
  1043.         
  1044.         virtual Boolean    GetState();
  1045.         virtual void    SetState(Boolean isDisclosed, Boolean redraw);
  1046.         virtual void    SetStateAnimate(Boolean isDisclosed);
  1047.  
  1048.     protected:
  1049.  
  1050.         virtual void    SetTrackingState(Boolean isIn);
  1051.  
  1052.         enum DTAnimationState { kDTClosed, kDTPressedClosed, kDTIntermediate, kDTPressedDisclosed, kDTDisclosed };
  1053.  
  1054.         virtual void    DrawTriangle(DTAnimationState state);
  1055.         virtual void    EraseBackground();
  1056.  
  1057.         Boolean        mAutomaticState;    // if true, triangle is toggled on click w/o caller needing to call SetValue
  1058.         Boolean        mIsDisclosed;
  1059.     };
  1060.  
  1061. #pragma mark AGAProgressIndicator
  1062.  
  1063. //
  1064. // AGAProgressIndicator ---------------------------------------------------------------
  1065. //
  1066. // AGAProgressIndicator implements the standard AGA progress indicator.
  1067. // It can be determinate (a moving gauge) or indeterminate (a rotating
  1068. // barber pole). In addition, it supports a "moving origin", which is
  1069. // where, in addition to moving the gauge end point, the gauge start
  1070. // point also moves.
  1071. //
  1072.  
  1073. class AGAProgressIndicator : public AGAObject
  1074.     {
  1075.     public:
  1076.  
  1077.         static OSErr AllocateProgressImages();
  1078.         static void DisposeProgressImages();
  1079.  
  1080.         AGAProgressIndicator(Rect* bounds, SInt32 minimum, SInt32 maximum);
  1081.         virtual ~AGAProgressIndicator();
  1082.         
  1083.         virtual void    DrawObject();
  1084.         
  1085.         virtual SInt32    GetValue();
  1086.         virtual void    SetValue(SInt32 newValue, Boolean redraw);
  1087.         virtual void    Increment(SInt32 delta, Boolean redraw);
  1088.         
  1089.         virtual void    Animate();            // moves indeterminate indicator by 1
  1090.         virtual void    QuantizedAnimate();    // moves it only if kAnimationDelay has elapsed
  1091.         
  1092.         virtual void    GetRange(SInt32* minimum, SInt32* maximum);
  1093.         virtual void    SetRange(SInt32 newMinimum, SInt32 newMaximum, Boolean redraw);
  1094.         
  1095.         virtual SInt32    GetOriginValue();
  1096.         virtual void    SetOriginValue(SInt32 newValue, Boolean redraw);
  1097.  
  1098.     protected:
  1099.  
  1100.         virtual void    DrawFrame();
  1101.         virtual void    DrawAnimationStep();
  1102.         virtual void    DrawGauge();
  1103.         virtual void    DrawOriginArea();
  1104.         virtual void    DrawProgressArea();
  1105.         virtual void    DrawRemainderArea();
  1106.         
  1107.         virtual Boolean    GetOriginFrame(Rect* originFrame);
  1108.         virtual Boolean    GetProgressFrame(Rect* progressFrame);
  1109.         virtual Boolean    GetRemainderFrame(Rect* remainderFrame);
  1110.         virtual void    GetRangeFrame(SInt32 startValue, SInt32 endValue, Rect* rangeFrame);
  1111.  
  1112.         enum { kProgressHeight = 14 };
  1113.         enum { kProgressImageHeight = 10, kProgressImageWidth = 16 };
  1114.         enum { k1BitPattern, kDeepPattern, kNumProgressPatterns };
  1115.         enum { kNumProgressAnimationSteps = 4 };    // 2, 4, 8, or 16 will work
  1116.         enum { kAnimationDelay = 5 };
  1117.  
  1118.         SInt32        mMinimum;
  1119.         SInt32        mMaximum;
  1120.         SInt32        mValue;
  1121.         SInt32        mOriginValue;        // usually == mMinimum
  1122.         UInt32        mAnimationIndex;
  1123.         SInt32        mLastAnimationTime;    // used for quantized animation
  1124.  
  1125.         static SInt8                kIndeterminateProgressImage[kNumProgressPatterns]
  1126.                                                                 [kProgressImageHeight]
  1127.                                                                 [kProgressImageWidth];
  1128.  
  1129.         static AGAOffscreenImage*    mgOffscreenIndeterminateProgressImage[kNumProgressPatterns];
  1130.     };
  1131.  
  1132. #pragma mark AGASeparator
  1133.  
  1134. //
  1135. // AGASeparator ---------------------------------------------------------------
  1136. //
  1137. // AGASeparator implements the standard AGA separator line.
  1138. // It automatically determines its orientation based on the coordinate
  1139. // bounding box dimensions.
  1140. //
  1141.  
  1142. class AGASeparator : public AGAObject
  1143.     {
  1144.     public:
  1145.  
  1146.         AGASeparator(Rect* bounds);
  1147.         virtual ~AGASeparator();
  1148.         
  1149.         virtual void    DrawObject();
  1150.     };
  1151.  
  1152. #pragma mark AGAGroupBox
  1153.  
  1154. //
  1155. // AGAGroupBox ---------------------------------------------------------------
  1156. //
  1157. // AGAGroupBox implements the standard AGA group box. A group box can
  1158. // either be primary or secondary. Secondary group boxes should be used
  1159. // inside primary group boxes, sez the AGA spec. You can supply a title
  1160. // string for the group box, or you can specify a "gap" width that is to
  1161. // be left blank to make room for a control or title string that will
  1162. // be drawn elsewhere.
  1163. //
  1164.  
  1165. class AGAGroupBox : public AGAObject
  1166.     {
  1167.     public:
  1168.  
  1169.         enum { kPrimaryGroupBox = true, kSecondaryGroupBox = false };
  1170.  
  1171.         AGAGroupBox(Rect* bounds, const AGATextStyle& textStyle, Boolean groupBoxType);
  1172.         AGAGroupBox(Rect* bounds, const AGATextStyle& textStyle, Boolean groupBoxType, SInt16 titleGap);
  1173.         AGAGroupBox(Rect* bounds, const AGATextStyle& textStyle, Boolean groupBoxType, StringPtr titleString);
  1174.         AGAGroupBox(Rect* bounds, const AGATextStyle& textStyle, Boolean groupBoxType, SInt16 titleStringListResourceID, SInt16 titleStringIndex);
  1175.         virtual ~AGAGroupBox();
  1176.         
  1177.         virtual void    SetTitleGap(SInt16 titleGap);
  1178.         virtual void    SetTitle(StringPtr newTitle, Boolean redraw);
  1179.         
  1180.         virtual void    DrawObject();
  1181.  
  1182.     protected:
  1183.  
  1184.         virtual void    DrawPrimaryFrame(SInt16 topIndent, SInt16 gapSize);
  1185.         virtual void    DrawSecondaryFrame(SInt16 topIndent, SInt16 gapSize);
  1186.  
  1187.         Boolean            mIsPrimaryBox;
  1188.         SInt16            mTitleGap;    // horizontal gap for other object in title, no top indent
  1189.         Str255            mTitle;        // zero-length string indicates no title, no top indent
  1190.         AGATextStyle    mTextStyle;
  1191.     };
  1192.  
  1193. #pragma mark AGATabPanel
  1194.  
  1195. //
  1196. // AGATabPanel ---------------------------------------------------------------
  1197. //
  1198. // AGATabPanel implements an AGA tab panels control.
  1199. //
  1200. // You can specify the location of the tabs (top or bottom, left or right).
  1201. // (Only "top" tabs are currently implemented!!! Other values do NOT work yet.)
  1202. // You can specify whether the whole tab panel frame is drawn, or whether just
  1203. // the tabs themselves are drawn, which allows you to attach tabs to something
  1204. // that you are drawing yourself. The simple constructor decides this based on
  1205. // the object bounds: if it's too small, there's no frame.
  1206. //
  1207.  
  1208. typedef struct
  1209.     {
  1210.     StringHandle    mLabel;
  1211.     SInt32            mTabWidth;
  1212.     Boolean            mDisabled;
  1213.     void*            mUserData;    // used by adapter classes for pane/view pointer
  1214.     } TabInfo, *TabInfoPtr, **TabInfoHandle;
  1215.  
  1216. class AGATabPanel : public AGAObject
  1217.     {
  1218.     public:
  1219.  
  1220.         enum TabSize { kSmallTabs, kLargeTabs };
  1221.         enum TabsLocation { kTopTabs, kBottomTabs, kLeftTabs, kRightTabs };
  1222.         enum TabWidthKind { kVariableTabWidth, kCommonTabWidth };    // AGA spec is kVariableTabWidth
  1223.         enum { kDontShrink = false, kShrinkToFit = true };            // for SetNumTabs shrinkToFit
  1224.  
  1225.         static OSErr AllocateTabImages();
  1226.         static void DisposeTabImages();
  1227.  
  1228.         AGATabPanel(Rect* bounds, SInt32 initialTabIndex, const AGATextStyle& textStyle, SInt16 labelsID);
  1229.         AGATabPanel(Rect* bounds, SInt32 initialTabIndex, const AGATextStyle& textStyle, SInt16 labelsID, TabWidthKind widthKind, TabsLocation location, Boolean drawFrame);
  1230.         virtual ~AGATabPanel();
  1231.         
  1232.         virtual void    DrawObject();
  1233.         virtual Boolean    TrackMouse(Point mouseLocation);
  1234.         virtual void    SetObjectBounds(Rect* bounds, Boolean redraw);
  1235.         
  1236.         virtual SInt32    GetCurrentTab();
  1237.         virtual void    SetCurrentTab(SInt32 tabIndex, Boolean redraw);
  1238.         virtual SInt32    GetLastTabClicked();
  1239.         
  1240.         virtual void    SetTabSize(TabSize size);                            // specify large or small tabs
  1241.         virtual void    SetTabsLocation(TabsLocation location);                // specify tabs location
  1242.         virtual void    SetTabsWidth(TabWidthKind widthKind);                // specify tab vs. label width
  1243.         virtual SInt16    GetTabHeight();                                        // get "height" of the tabs
  1244.         virtual Boolean    HasFrame();                                            // true if we will draw a frame
  1245.         virtual void    SetLabelsFromResource(SInt16 stringListResourceID);    // creates 1 tab per string in the 'STR#'
  1246.         virtual void    SetNumTabs(SInt32 numLabels, Boolean shrinkToFit);    // ensures space for n tabs, optionally removes excess
  1247.         virtual SInt32    GetNumTabs();                                        // get number of tabs
  1248.         virtual void    SetTabLabel(SInt32 tabIndex, StringPtr itsLabel);    // set one tab's label
  1249.         virtual void    GetTabLabel(SInt32 tabIndex, StringPtr itsLabel);    // get one tab's label
  1250.         virtual void    SetTabEnable(SInt32 tabIndex, Boolean enable);        // enable/disable one tab
  1251.         virtual Boolean    IsTabEnabled(SInt32 tabIndex);                        // get enable/disable state of one tab
  1252.         virtual void    SetTabUserData(SInt32 tabIndex, void* userData);    // set extra data value for one tab; used by adapter classes for panel ptr
  1253.         virtual void*    GetTabUserData(SInt32 tabIndex);                    // get extra data value for one tab; used by adapter classes for panel ptr
  1254.         virtual void    CalculateTabWidths();                                // recalc all tab widths using current labels
  1255.         virtual void    SetLabelsStyle(const AGATextStyle& textStyle);        // set the text style for the labels
  1256.  
  1257.     protected:
  1258.  
  1259.         enum { kSmallTabImageHeight = 19, kSmallTabImageWidth = 12 };
  1260.         enum { kLargeTabImageHeight = 24, kLargeTabImageWidth = 12 };
  1261.         enum { kPanelEndMargin = 6 };
  1262.  
  1263.         // AGAObject mouse tracking overrides.
  1264.         virtual Boolean    HitTest(Point mouseLocation);
  1265.         virtual void    SetTrackingState(Boolean isIn);
  1266.  
  1267.         virtual void    DrawBackground();
  1268.         virtual void    DrawFrame();
  1269.         virtual void    DrawTabs();
  1270.         
  1271.         virtual void    DrawFrameBox();
  1272.         virtual void    DrawFrameTop();
  1273.         virtual void    DrawOneTab(SInt32 tabIndex, Boolean pressed);
  1274.         virtual void    GetTabBounds(SInt32 tabIndex, Rect* tabBounds);
  1275.         virtual void    CalculateTabWidthsByKind(TabWidthKind widthKind);
  1276.         
  1277.         virtual void    CalculateTabSizeInfo();
  1278.         
  1279.         virtual void    AllocateTabInfo(SInt32 numTabs, Boolean shrinkToFit);
  1280.         virtual void    DisposeTabInfo();
  1281.         
  1282.         virtual void    CopyTabImage(UInt32 imageIndex, Point imageDestination, Boolean deep);
  1283.         
  1284.         SInt32            mNumTabs;
  1285.         SInt32            mCurrentTabIndex;
  1286.         SInt32            mLastTabClicked;
  1287.  
  1288.         TabInfoHandle    mTabInfo;                // handle to array of TabInfo
  1289.         TabSize            mTabSize;                // small or large
  1290.         TabsLocation    mTabsLocation;            // top, bottom, left, or right
  1291.         TabWidthKind    mTabWidthKind;            // variable or same
  1292.         Point            mTabImageSize;            // depends on mTabSize & mTabsLocation
  1293.         Boolean            mDrawFrame;
  1294.         AGATextStyle    mTextStyle;
  1295.  
  1296.         // Drawing the tab contours manually is too tedious.
  1297.         // So we use offscreen PixMap structures and blast them onto the screen.
  1298.         // Current implementation doesn't use clip, so must be on an r2 background.
  1299.  
  1300.         enum { kSmallTabImages, kLargeTabImages, kNumImageTypes };
  1301.         enum { kTabNormalDeselectedL, kTabNormalDeselectedR,
  1302.                 kTabNormalSelectedL, kTabNormalSelectedR,
  1303.                 kTabPressedL, kTabPressedR,
  1304.                 kTabDisabledDeselectedL, kTabDisabledDeselectedR,
  1305.                 kTabDisabledSelectedL, kTabDisabledSelectedR,
  1306.                 kNumTabImages };
  1307.         
  1308.         static SInt8    kSmallTabImageValues [kNumTabImages] [kSmallTabImageHeight] [kSmallTabImageWidth];
  1309.         static SInt8    kLargeTabImageValues [kNumTabImages] [kLargeTabImageHeight] [kLargeTabImageWidth];
  1310.  
  1311.         static SInt8    k1BitSmallTabImageValues [kNumTabImages] [kSmallTabImageHeight] [kSmallTabImageWidth];
  1312.         static SInt8    k1BitLargeTabImageValues [kNumTabImages] [kLargeTabImageHeight] [kLargeTabImageWidth];
  1313.  
  1314.         static AGAOffscreenImage*    mgOffscreenTabImages [kNumTabImages] [kNumImageTypes];
  1315.         static AGAOffscreenImage*    mg1BitOffscreenTabImages [kNumTabImages] [kNumImageTypes];
  1316.     };
  1317.  
  1318. #pragma mark GDIterator
  1319.  
  1320. //
  1321. // GDIterator -----------------------------------------------------
  1322. //
  1323. // To properly handle drawing in grayscale with multiple monitors
  1324. // and differing color depths, we must draw while iterating over
  1325. // the GD handles. This iterator makes a for loop easy while also
  1326. // reducing the clipping area to the appropriate device and setting
  1327. // a boolean to indicate whether the device is "deep" or not. "Deep"
  1328. // meaning suitable for grayscale drawing as opposed to black & white.
  1329. //
  1330.  
  1331. class GDIterator
  1332.     {
  1333.     public:
  1334.     
  1335.         GDIterator();
  1336.         virtual ~GDIterator();
  1337.         
  1338.         void    Setup();            // called by constructor; can be called again
  1339.         Boolean    More(Boolean& deep);// returns true while you should draw again
  1340.         void    Cleanup();            // called by destructor; can be called earlier
  1341.         
  1342.         void    ClipFurtherToCurrentDevice();    // can be called for tricky clipping situations (see slider labels)
  1343.  
  1344.     protected:
  1345.     
  1346.         // To look good in gray we need 4 bits in monochrome, or 8 bits in color.
  1347.         // This is because 2 bits monochrome is only black, white, plus 2 shades;
  1348.         // and 4 bits in color is just that plus 12 irrelevant colors.
  1349.         enum { kDeepGrayscaleBits = 4, kDeepColorBits = 8 };
  1350.     
  1351.         GDHandle    FindNextValidDevice(GDHandle currentDevice, Boolean& deep);
  1352.         void        ClipFurtherToDevice(GDHandle aDevice);
  1353.  
  1354.         Boolean        mIteratedYet;
  1355.         GDHandle    mCurrentGDHandle;    // inited by Setup, changed by More
  1356.  
  1357.         static RgnHandle    mSavedClipping;        // saved by Setup, restored by Cleanup
  1358.     };
  1359.  
  1360. #pragma mark AGAGroupsContainer
  1361.  
  1362. //
  1363. // AGAGroupsContainer --------------------------------------------------------
  1364. //
  1365. // This class is used internally to maintain the MExclusiveObject
  1366. // behavior that allows radio buttons to automatically maintain
  1367. // standard radio button group XOR behavior.
  1368. // It just maintains an array of AGAGroupMember structs, each of
  1369. // which identifies the group ID and contains a pointer to a
  1370. // group member.
  1371. // If you're using the adapter classes, this is not used.
  1372. //
  1373.  
  1374. typedef struct
  1375.     {
  1376.     UInt32                        mGroupIDPart1;
  1377.     UInt32                        mGroupIDPart2;
  1378.     MExclusiveObject*            mGroupMember;
  1379.     } AGAGroupMember;
  1380.  
  1381. class AGAGroupsContainer
  1382.  
  1383. #ifdef AGA_SUPERCLASS
  1384.     : public AGA_SUPERCLASS
  1385. #endif // AGA_SUPERCLASS
  1386.  
  1387.     {
  1388.     public:
  1389.     
  1390.         AGAGroupsContainer();
  1391.         virtual ~AGAGroupsContainer();
  1392.  
  1393.         void    AGAAddGroupMember(MExclusiveObject* groupMember);
  1394.         void    AGARemoveGroupMember(MExclusiveObject* groupMember);
  1395.         void    AGAHitGroupMember(MExclusiveObject* groupMember);
  1396.  
  1397.     protected:
  1398.     
  1399.         void    AddGroupMember(MExclusiveObject* groupMember, Boolean allowExpand);
  1400.         void    ExpandArray();
  1401.  
  1402.         enum { kGroupArrayChunkSize = 16 };
  1403.  
  1404.         UInt32                mGroupsArraySize;
  1405.         AGAGroupMember**    mGroups;    // Handle to array of AGAGroupMember
  1406.     };
  1407.  
  1408. #pragma mark AGA_Globals
  1409.  
  1410. //
  1411. // Global functions and variables -------------------------------------------
  1412. //
  1413.  
  1414. //
  1415. // These are the gAGARamp RGB color value indexes.
  1416. // They match the numbers specified in the AGA doc.
  1417. // rW is white.
  1418. // 1 thru 12 go from light gray to dark gray, matching AGA doc indexes.
  1419. // rA1 and rA2 are the additional dark grays referenced in the AGA doc.
  1420. // rB is black.
  1421. // rP1 thru rP4 are the purple shades for the disclosure triangle.
  1422. //
  1423.  
  1424. typedef enum
  1425.     {
  1426.     rW = 0,
  1427.     r1 = 1,
  1428.     r2 = 2,
  1429.     r3 = 3,
  1430.     r4 = 4,
  1431.     r5 = 5,
  1432.     r6 = 6,
  1433.     r7 = 7,
  1434.     r8 = 8,
  1435.     r9 = 9,
  1436.     r10 = 10,
  1437.     r11 = 11,
  1438.     r12 = 12,
  1439.     rA1 = 13,
  1440.     rA2 = 13,
  1441.     rB = 15,
  1442.     rP1 = 16,
  1443.     rP2 = 17,
  1444.     rP3 = 18,
  1445.     rP4 = 19,
  1446.     
  1447.     kNumRampColors,
  1448.     
  1449.     OUT = -1
  1450.     } RampIndex;
  1451.  
  1452. extern RGBColor                gAGARamp[kNumRampColors];
  1453. extern Boolean                gAGAHasColorQD;
  1454. extern const Str255         gGrayCouncilCopyright;
  1455. extern AGAGroupsContainer*    gGroupsContainer;
  1456. extern UInt32                gAGADefaults;
  1457.  
  1458. // Turn default behavioral attributes off or on with these calls.
  1459. // These affect what default attributes are used for certain objects
  1460. // at the time they are instantiated, in the case where the attribute
  1461. // is not explicitly set as a constructor parameter or adapter class
  1462. // function.
  1463. extern void SetGrayCouncilDefault(UInt32 itemMask, Boolean turnOn);
  1464. extern Boolean TestGrayCouncilDefault(UInt32 itemMask);
  1465.  
  1466. // These are the attributes you can turn off or on with the above calls.
  1467. // They only affect new objects, not existing ones.
  1468. #define kAGALiveScrolling            0x00000001
  1469. #define kAGAProportionalScrolling    0x00000002
  1470. #define kAGALiveRSliders            0x00000004
  1471. #define kAGAProportionalRSliders    0x00000008
  1472. #define kAGALivePSliders            0x00000010
  1473. #define kAGAProportionalPSliders    0x00000020
  1474.  
  1475. // AGAStringOut is used by the AGA classes to draw their text.
  1476. #define kNoTruncation -1    // Toolbox defines smTruncEnd, smTruncMiddle, etc.
  1477. enum AGAStringOutColor { kNormalOutput, kDisabledOutput, kInverseOutput, kUseCurrentColor };
  1478. extern void AGAStringOut(StringPtr aString,
  1479.                         Rect* centeringFrame,
  1480.                         SInt32 truncation,
  1481.                         SInt32 justification,
  1482.                         AGAStringOutColor outColor,
  1483.                         Boolean deep,
  1484.                         const AGATextStyle& textStyle);
  1485.  
  1486. // AGATextBox is a replacement for TETextBox, with the same initial parameters, plus
  1487. // a couple of extra ones for AGA control over the text. This is used by AGAStaticText.
  1488. extern void AGATextBox(const void *textPtr,
  1489.                         SInt32 textLength,
  1490.                         const Rect *textFrame,
  1491.                         SInt16 justification,
  1492.                         AGAStringOutColor outColor,
  1493.                         Boolean deep,
  1494.                         const AGATextStyle& textStyle,
  1495.                         const RGBColor* teBackgroundColor);
  1496.  
  1497. // AGABackgroundPaint is used to paint window backgrounds.
  1498. enum AGABackgroundKind { kRaisedModelessBackground, kRaisedModalBackground, kFlatWindowBackground, kNoBackgroundPaint };
  1499. extern void AGABackgroundPaint(const Rect* backgroundBounds,
  1500.                                 Boolean drawFill,
  1501.                                 AGABackgroundKind backgroundKind,
  1502.                                 Boolean isActive,
  1503.                                 Boolean hasGrowBox);
  1504.                 
  1505. // AGAInstallGrayWCTB is used to install gray r2 into the window's 'wctb' background.                
  1506. extern OSErr AGAInstallGrayWCTB(WindowPtr aWindow);
  1507.  
  1508. // AGADrawBorderFrame is used to draw the "3D" sunken frame around an object.
  1509. // It supports correct dimming and "notched" shape (contoured to scroll bars).
  1510. extern void AGADrawBorderFrame(const Rect* bounds, Boolean isEnabled, Boolean isNotched, Boolean drawFrame, const RGBColor* windowBackgroundColor);
  1511.  
  1512. // AGAComputeTargetBorderRegion is used to build a region that defines the
  1513. // target border, aka "focus" frame.
  1514. // It supports "notched" shape (contoured to scroll bars).
  1515. extern void AGAComputeTargetBorderRegion(RgnHandle borderRegion, const Rect* bounds, Boolean isNotched);
  1516.  
  1517. // AGAClipFurther shrinks the clip region further from its current area
  1518. // to prevent drawing outside the specified rect.
  1519. extern void AGAClipFurther(Rect* clippingRect);
  1520.  
  1521. // AGA_PLstrcpy is a replacement for PLstrcpy so the plstringfuncs library is not needed.
  1522. // It's just a BlockMoveData call.
  1523. extern void AGA_PLstrcpy(StringPtr str1, ConstStr255Param str2);
  1524.  
  1525. // These background color determination routines are used by the adapter
  1526. // classes during instantiation of certain view types that must erase
  1527. // their background, and because tab panels vary the background color.
  1528. // See more comments where these are implemented.
  1529. enum { kInstallOnlyIfCustom = false, kInstallAlways = true };    // MacApp & PowerPlant need different behavior here
  1530. extern Boolean DetermineAGABackgroundColors(RGBColor* enabledColor, RGBColor* disabledColor, Boolean installIfNotCustom);
  1531. extern void InstallAGABackgroundColors(AGAObject* itsAGAObject, Boolean installIfNotCustom);
  1532. extern void TurnOnCustomAGABackgroundColors(RGBColor* enabledColor, RGBColor* disabledColor);
  1533. extern void TurnOffCustomAGABackgroundColors();
  1534.  
  1535. #endif // __GRAYCOUNCIL__
  1536.  
  1537.